<?php
require './include/common.inc.php';
require 'admin/include/message.class.php';

$message = new message();
$types = $message->type_list;
$action = @get_null($action);
$page_title = '留言板  --  '.$site_conf->get('SITE_NAME');
$css_file = 'chl.css';
$cattitle = '留言板';
$top_catid = '123123';
switch ($action)
{
    case 'message':
        include template('default', 'message1');
        break;
    default:
        if(isset($_POST['data']))
        {
            $data = $_POST['data'];
            if(empty($data['truename']))
            {
                $response->alert('请填写您的姓名');
                $response->execute();
            }
            if(empty($data['tel']))
            {
                $response->alert('请填写您的联系方式');
                $response->execute();
            }
            if(empty($data['content']))
            {
                $response->alert('请填写您的咨询内容');
                $response->execute();
            }
            $data['addtime'] = time();
            $message->add($data);
            $response->script('showDialog();');
            $response->execute();
        }
        else
        {
            include template('default', 'message');
        }
}

?>
